package cn.jbolt.ai.app.controller;

import cn.jbolt.ai.app.service.AiAppNodeService;
import cn.jbolt.util.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Controller
@ResponseBody
@RequestMapping("/aiAppNode")
@Tag(name = "Ai应用节点管理Controller")
public class AiAppNodeController {

    @Autowired
    private AiAppNodeService AiAppNodeService;

    @Operation(summary = "根据APPID获取节点信息", description = "根据APPID获取节点信息")
    @GetMapping("/getNodesByAppId/{appId}")
    public Result getNodesByAppId(@PathVariable Long appId) {
        return AiAppNodeService.getNodesByAppId(appId);
    }


    /**
     * 更新节点的关联关系
     *
     * @param id       节点ID
     * @param caseName
     * @param afterId
     * @return
     */
    @Operation(summary = "更新节点的关联关系")
    @GetMapping("/addNodeAfters")
    public Result addNodeAfters(Long id, String caseName, Long afterId){
        return AiAppNodeService.addNodeAfters(id, caseName, afterId);
    };

}
